package string;

public class IndexDemo {
    public static void main(String[] args) {
        String str = "thinking in java";
        int index = str.indexOf("in");
        System.out.println(index);

        index = str.indexOf("int",6);
        System.out.println(index);
        if(index == -1){
            System.out.println("没找着");
        }

        index = str.lastIndexOf("in");//检索in在str中最后一次出现的位置
        System.out.println(index);
    }
}
